package com.gopay.common.constants.riskcontrol;

import com.gopay.common.constants.trans.PayChannel;

import java.util.*;

/**
 * Created by liuyong on 2017/5/24.
 *额度管理校验方向和校验方向所对应的支付方式枚举类
 */
public enum RclCheckObj {

    RECV("RECV"),                    //收方-支付方式为所有

    RECV_C_ACCOUNT("RECV_C_ACCOUNT"),  //收方-支付方式为个人虚拟账号 paychannel的取值（02）

    RECV_B_ACCOUNT("RECV_B_ACCOUNT"),  //收方-支付方式为企业虚拟账号  paychannel的取值（52）

    RECV_C_BANK("RECV_C_BANK"),        //收方-支付方式为个人银行账户（个人网银和快捷）paychannel的取值（01,03,04,06,08,16,17,18,30,31,32,33,49,50）

    RECV_B_BANK("RECV_B_BANK"),        //收方-支付方式为企业银行账户 paychannel的取值（51,98,99）

    PAY("PAY"),                      //付方-支付方式为所有

    PAY_B_ACCOUNT("PAY_B_ACCOUNT"),    //付方-支付方式为企业虚拟账户

    PAY_C_ACCOUNT("PAY_C_ACCOUNT"),    //付方-支付方式为个人虚拟账户

    PAY_C_BANK("PAY_C_BANK"),          //付方-支付方式为个人银行账户（个人网银和快捷）

    PAY_B_BANK("PAY_B_BANK");          //付方-支付方式为企业银行账户

    public final String value;

    RclCheckObj(String value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return this.value;
    }

    public static List<String> getPayChannel(String rclCheckObj){
        Map<String,List<String>> checkObjpaychannelMap = new HashMap<>();

        List<String> allPaychannel = new ArrayList<>();
        allPaychannel.add(PayChannel._01.value);
        allPaychannel.add(PayChannel._02.value);
        allPaychannel.add(PayChannel._03.value);
        allPaychannel.add(PayChannel._04.value);
        allPaychannel.add(PayChannel._06.value);
        allPaychannel.add(PayChannel._08.value);
        allPaychannel.add(PayChannel._49.value);
        allPaychannel.add(PayChannel._50.value);
        allPaychannel.add(PayChannel._51.value);
        allPaychannel.add(PayChannel._52.value);
        allPaychannel.add(PayChannel._98.value);
        allPaychannel.add(PayChannel._99.value);
        allPaychannel.add(PayChannel._16.value);
        allPaychannel.add(PayChannel._17.value);
        allPaychannel.add(PayChannel._18.value);
        allPaychannel.add(PayChannel._30.value);
        allPaychannel.add(PayChannel._31.value);
        allPaychannel.add(PayChannel._32.value);
        allPaychannel.add(PayChannel._33.value);
        allPaychannel.add(PayChannel._34.value);
        allPaychannel.add(PayChannel._28.value);
        allPaychannel.add(PayChannel._25.value);

        checkObjpaychannelMap.put(RclCheckObj.PAY.value,allPaychannel);
        checkObjpaychannelMap.put(RclCheckObj.RECV.value,allPaychannel);

        List<String> cAccountPaychannel = new ArrayList<>();
        cAccountPaychannel.add(PayChannel._02.value);
        checkObjpaychannelMap.put(RclCheckObj.PAY_C_ACCOUNT.value,cAccountPaychannel);
        checkObjpaychannelMap.put(RclCheckObj.RECV_C_ACCOUNT.value,cAccountPaychannel);

        List<String> bAccountPaychannel = new ArrayList<>();
        bAccountPaychannel.add(PayChannel._52.value);
        checkObjpaychannelMap.put(RclCheckObj.PAY_B_ACCOUNT.value,bAccountPaychannel);
        checkObjpaychannelMap.put(RclCheckObj.RECV_B_ACCOUNT.value,bAccountPaychannel);

        List<String> cBankPaychannel = new ArrayList<>();
        cBankPaychannel.add(PayChannel._01.value);
        cBankPaychannel.add(PayChannel._03.value);
        cBankPaychannel.add(PayChannel._04.value);
        cBankPaychannel.add(PayChannel._06.value);
        cBankPaychannel.add(PayChannel._08.value);
        cBankPaychannel.add(PayChannel._49.value);
        cBankPaychannel.add(PayChannel._50.value);
        cBankPaychannel.add(PayChannel._16.value);
        cBankPaychannel.add(PayChannel._17.value);
        cBankPaychannel.add(PayChannel._18.value);
        cBankPaychannel.add(PayChannel._30.value);
        cBankPaychannel.add(PayChannel._31.value);
        cBankPaychannel.add(PayChannel._32.value);
        cBankPaychannel.add(PayChannel._33.value);
        cBankPaychannel.add(PayChannel._34.value);
        cBankPaychannel.add(PayChannel._28.value);
        cBankPaychannel.add(PayChannel._25.value);

        checkObjpaychannelMap.put(RclCheckObj.PAY_C_BANK.value,cBankPaychannel);
        checkObjpaychannelMap.put(RclCheckObj.RECV_C_BANK.value,cBankPaychannel);

        List<String> bBankPaychannel = new ArrayList<>();
        bBankPaychannel.add(PayChannel._51.value);
        bBankPaychannel.add(PayChannel._98.value);
        bBankPaychannel.add(PayChannel._99.value);
        checkObjpaychannelMap.put(RclCheckObj.PAY_B_BANK.value,bBankPaychannel);
        checkObjpaychannelMap.put(RclCheckObj.RECV_B_BANK.value,bBankPaychannel);

        return checkObjpaychannelMap.get(rclCheckObj);
    }


    public static Map<String ,String> TranslateRclCheckObj(){
        Map<String,String> rclCheckObjMap = new TreeMap<String,String>();
        rclCheckObjMap.put("RECV","收方-支付方式为所有");
        rclCheckObjMap.put("RECV_C_ACCOUNT","收方-支付方式为个人虚拟账号");
        rclCheckObjMap.put("RECV_B_ACCOUNT","收方-支付方式为企业虚拟账号");
        rclCheckObjMap.put("RECV_C_BANK","收方-支付方式为个人银行账户");
        rclCheckObjMap.put("RECV_B_BANK","收方-支付方式为企业银行账户");
        rclCheckObjMap.put("PAY","付方-支付方式为所有");
        rclCheckObjMap.put("PAY_B_ACCOUNT","付方-支付方式为企业虚拟账户");
        rclCheckObjMap.put("PAY_C_ACCOUNT","付方-支付方式为个人虚拟账户");
        rclCheckObjMap.put("PAY_C_BANK","付方-支付方式为个人银行账户");
        rclCheckObjMap.put("PAY_B_BANK","付方-支付方式为企业银行账户");

        return rclCheckObjMap;
    }




}
